
# SWIG Python interface
# Faraz Mirzaei
# University of Minnesota
# faraz@cs.umn.edu
#
# $LastChangedDate: 2008-06-12 13:02:05 -0500 (Thu, 12 Jun 2008) $
# $Rev: 371 $

INCDIR = -I/home/faraz/devel/opencv-1.0.0/build/include/opencv -I/home/faraz/devel/alvar-1.5.0-linux64/include -I/usr/include/python2.6
LIBDIR = -L/home/faraz/devel/opencv-1.0.0/build/lib -L/home/faraz/devel/alvar-1.5.0-linux64/bin/linux 

SWIG = swig
CC = g++
LD = g++


SWIGFLAGS = -c++ -python
#CFLAGS = -g -Wall -I${INCDIR}
#LDFLAGS = -G -L${LIBDIR} -lhighgui

CFLAGS = -g -fpic -Wall ${INCDIR}
LDFLAGS = -shared ${LIBDIR} -lhighgui -lalvar150


TARGETSRC = alvar.cpp
TARGET = $(join _,$(TARGETSRC:.cpp=.so))
INTRFC = $(TARGETSRC:.cpp=.i)
WRAPER = $(TARGETSRC:.cpp=_wrap.cpp)
SRCS = $(TARGETSRC) $(WRAPER)
OBJS = $(SRCS:.cpp=.o) 

# pattern rule
%.o:%.cpp
	$(CC) -o $@ -c $(CFLAGS) $<

all: $(TARGET)

$(WRAPER): $(INTRFC)
	$(SWIG) $(SWIGFLAGS) -o $(WRAPER) $(INTRFC)

$(TARGET): $(WRPROBJ) $(OBJS)
	$(LD) $(LDFLAGS) $(OBJS) -o $(TARGET) 

#dosubdirs:
#	@for i in $(SUBDIRS); do \
#		make -C $$i; \
#	done
#@echo "--- done compiling $(TARGETS) ---"

clean:
	rm -f $(TARGET) $(OBJS) $(WRAPER) *pyc *~ alvar.py


.PHONY: clean all

